home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 23 / AACD 23.iso / AACD / Magazine / PC2Amiga / Samba / docs / textdocs / Printing.txt < prev    next >
Text File  |  2000-04-25  |  6KB  |  150 lines

  1. !==
  2. !== Printing.txt for Samba release 2.0.7 26 Apr 2000
  3. !==
  4. Contributor:    Unknown <samba@samba.org>
  5. Date:        Unknown
  6. Status:        Current
  7.  
  8. Subject:    Dubugging Printing Problems
  9. =============================================================================
  10.  
  11. This is a short description of how to debug printing problems with
  12. Samba. This describes how to debug problems with printing from a SMB
  13. client to a Samba server, not the other way around. For the reverse
  14. see the examples/printing directory.
  15.  
  16. Please send enhancements to this file to samba@samba.org
  17.  
  18. Ok, so you want to print to a Samba server from your PC. The first
  19. thing you need to understand is that Samba does not actually do any
  20. printing itself, it just acts as a middleman between your PC client
  21. and your Unix printing subsystem. Samba receives the file from the PC
  22. then passes the file to a external "print command". What print command
  23. you use is up to you.
  24.  
  25. The whole things is controlled using options in smb.conf. The most
  26. relevant options (which you should look up in the smb.conf man page)
  27. are:
  28.         print command
  29.         lpq command
  30.         lprm command
  31.  
  32. Samba should set reasonable defaults for these depending on your
  33. system type, but it isn't clairvoyant. It is not uncommon that you
  34. have to tweak these for local conditions.
  35.  
  36. On my system I use the following settings:
  37.  
  38.         print command = lpr -r -P%p %s
  39.         lpq command = lpq -P%p
  40.         lprm command = lprm -P%p %j
  41.  
  42. The % bits are "macros" that get dynamically replaced with variables
  43. when they are used. The %s gets replaced with the name of the spool
  44. file that Samba creates and the %p gets replaced with the name of the
  45. printer. The %j gets replaced with the "job number" which comes from
  46. the lpq output.
  47.  
  48. When I'm debugging printing problems I often replace these command
  49. with pointers to shell scripts that record the arguments, and the
  50. contents of the print file. A simple example of this kind of things
  51. might be:
  52.  
  53.     print command = cp %s /tmp/tmp.print
  54.  
  55. then you print a file and look at the /tmp/tmp.print file to see what
  56. is produced. Try printing this file with lpr. Does it work? If not
  57. then the problem is with your lpr system, not with Samba. Often
  58. people have problems with their /etc/printcap file or permissions on
  59. various print queues. 
  60.  
  61. Another common problem is that /dev/null is not world writeable. Yes,
  62. amazing as it may seem, some systems make /dev/null only writeable by
  63. root. Samba uses /dev/null as a place to discard output from external
  64. commands like the "print command" so if /dev/null is not writeable
  65. then nothing will work.
  66.  
  67. Other really common problems:
  68.  
  69. - lpr isn't in the search path when Samba tries to run it. Fix this by
  70. using the full path name in the "print command"
  71.  
  72. - the user that the PC is trying to print as doesn't have permission
  73. to print. Fix your lpr system.
  74.  
  75. - you get an extra blank page of output. Fix this in your lpr system,
  76. probably by editing /etc/printcap. It could also be caused by
  77. incorrect setting on your client. For example, under Win95 there is a
  78. option Printers|Printer Name|(Right
  79. Click)Properties|Postscript|Advanced| that allows you to choose if a
  80. Ctrl-D is appended to all jobs. This will affect if a blank page is
  81. output. 
  82.  
  83. - you get raw postscript instead of nice graphics on the output. Fix
  84. this either by using a "print command" that cleans up the file before
  85. sending it to lpr or by using the "postscript" option in smb.conf.
  86.  
  87. Note that you can do some pretty magic things by using your
  88. imagination with the "print command" option and some shell
  89. scripts. Doing print accounting is easy by passing the %U option to a
  90. print command shell script. You could even make the print command
  91. detect the type of output and its size and send it to an appropriate
  92. printer. 
  93.  
  94. If the above debug tips don't help, then maybe you need to bring in
  95. the bug gun, system tracing. See Tracing.txt in this directory.
  96.  
  97. =====================================================================
  98. From Caldera Inc., the following documentation has been
  99. contributed. Note that it contains stuff that is only relevant on some
  100. systems (specifically Caldera OpenLinux systems).
  101.  
  102.  
  103. 8.6 Setting up a raw SAMBA printer.
  104.  
  105. Note: this is not a guide on setting up SAMBA. It merely addresses
  106. creating a printer configuration that will allow the output of regular
  107. (i.e. not PostScript) Windows printer drivers to print through SAMBA.
  108.  
  109. Regular Windows printer drivers can be used to print via SAMBA, but
  110. you must set up a raw printer entry in "/etc/printcap" to accomplish
  111. this. Also, a print command will need to be specified in
  112. "/etc/smb.conf" that forces binary printing.
  113.  
  114. The best way to start is to use printtool under X to create a new
  115. entry specifically for this printer. All you really need for it to do
  116. is create the necessary directories and set the permissions correctly,
  117. so don't worry about setting up a filter for a specific printer.
  118. Filters are not going to be used at all for this entry.
  119.  
  120. Next, go into "/etc" and edit the printcap entry you just created,
  121. changing it to look like this (if you named it something other than
  122. raw, the entry name and spool directory should be changed here to
  123. match):
  124.  
  125. raw:\
  126.     :rw:sh: \
  127.     :lp=/dev/lp1: \
  128.     :sd=/var/spool/lpd/raw: \
  129.     :fx=flp:
  130.  
  131. When this is done and saved, edit the section of the smb.conf file
  132. that applies to the printer. Make sure the name of the section
  133. (enclosed in brackets) matches the name of the raw printer you just
  134. set up, then go down a line or two and add this line:
  135.  
  136. print command = lpr -b -P%p %s
  137.  
  138. Save the file, change to "/etc/rc.d/init.d", and type the following
  139. commands to restart the necessary daemons:
  140.  
  141. ./lpd stop
  142. ./lpd start
  143. ./smb stop
  144. ./smb start
  145.  
  146. At this point you should be ready to use the various printer drivers on
  147. your Windows clients for printing.
  148. =============================================================================
  149.  
  150.